package tp.pr5;

/*
 * 
 * 
 * esta clase esta lista para la practica 3
 * 
 * 
 * */
import tp.pr5.commands.*;
import tp.pr5.commands.exceptions.WrongCommandFormatException;

public class Parser
{
	public Parser()
	{

	}

	static private Command[] commandList =
	{ new GoCommand(), new DropCommand(), new ExamineCommand(),
			new HelpCommand(), new LookCommand(), new PickCommand(),
			new QuitCommand(), new UseCommand(), };

	public static Command parseCommand(String line)
			throws WrongCommandFormatException
	{
		for (Command comando : commandList)
		{
			try
			{
				return comando.parse(line);
			} catch (Exception e)
			{
			}
		}
		throw new WrongCommandFormatException(MensajesConst.what);
	}

	public static String getHelp() // modificado para practica 3
	{
		return MensajesConst.help;
	}

}
